from django.core.management.base import BaseCommand
from catalog.models import BookInstance

class Command(BaseCommand):
    help = '将所有图书副本状态批量改为Available（可借）'

    def handle(self, *args, **kwargs):
        count = BookInstance.objects.update(status='a')
        self.stdout.write(self.style.SUCCESS(f'已将{count}个副本状态改为Available')) 